import request from '@/utils/request'

// 查询菜单列表
export function listMenu(query) {
  return request({
    url: '/sysMenu/list',
    method: 'get',
    params: query
  })
}

// 查询菜单详细
export function getMenu(data) {
  return request({
    url: '/sysMenu/getInfo',
    method: 'post',
    data: data
  })
}

// 查询菜单下拉树结构
export function treeselect() {
  return request({
    url: '/sysMenu/menuTree',
    method: 'get'
  })
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(data) {
  // console.log(data)
  return request({
    url: '/sysMenu/roleMenuTree',
    method: 'post',
    data: data
  })
}

// 新增菜单
export function addMenu(data) {
  return request({
    url: '/sysMenu/create',
    method: 'post',
    data: data
  })
}

// 修改菜单
export function updateMenu(data) {
  return request({
    url: '/sysMenu/update',
    method: 'post',
    data: data
  })
}

// 删除菜单
export function delMenu(id) {
  const data = {
    id
  }
  return request({
    url: '/sysMenu/delete',
    method: 'post',
    data: data
  })
}

// 强制删除菜单
export function forceDelMenu(id) {
  const data = {
    id
  }
  return request({
    url: '/sysMenu/forceDelete',
    method: 'post',
    data: data
  })
}